import { defineComponent, reactive, onMounted, ref } from 'vue';
import Draw1 from './draw1'
import {parkSum} from "@/api/api";
import {useRoute} from "vue-router";
export default defineComponent({
  components: {
    Draw1
  },
  setup() {
    const route = useRoute();
    const { url } = route.params;
    const cdata1 = reactive({
      ylist:[],

    })
    const setlist = () => {
      parkSum(url+'dataView/car/addedCarM',{})
          .then(res=>{
            for (let i = 0; i < res.data.length; i++) {
              cdata1.ylist.push(res.data[i].y);
            }
                //this.y = { ...this.y
              }
          );
    }
    // 生命周期
    onMounted(() => {
      setlist()
    })

    return () => {
      return <div>
        <Draw1 cdata={cdata1} />
      </div>
    }
  }
})